<template>
<div>
      <!-- 轮播 -->
     <Banner></Banner>

  <div class="n-main-content">

    <!-- 内容 -->
    <div class="main-body">
        <side-menu active="1"></side-menu>
        <div class="a-main">
              <div class="wy-main-title">
                <p>首页 / 新闻资讯 / 国际新闻 / <span>详情</span></p>
            </div>
            <div class="all-detail">
                <h2>{{detail.contentTitle}}</h2>
                <div class="little-title">
                  <span>来源：{{detail.contentOrigin}}</span>
                  <span>发布时间：{{detail.createTime}}</span>
                  <span>浏览数：{{detail.looksNum}}次</span>
                </div>
                <p class="mark">标签 {{detail.contentLabel}}</p>
                <div class="detail-content" v-html="detail.contentTxt"></div>
            </div>
        </div>
    </div>
  </div>
</div>
</template>

<script>
import SideMenu from './../components/SideMenu.vue'
import Banner from './../components/Banner.vue'
import { newsData } from './../../../utils/newsData'
export default {
  components: {
      SideMenu,
      Banner
  },
    async asyncData ({ app, $axios, params, query, error }) {
        const returnData = {}
        const id = params.id
        try {
            const { data } = await $axios.$get('/api/content/content/open/getContentDeTail/'+id, { params: {} })
            returnData.detail = data;
        } catch (err) {
            return error({ statusCode: err.code, msg: err.msg })
        }
        return returnData
    },
  data () {
    return {
      detail: {},
      id:0
    }
  },
  created: function() {
     this.id = this.$route.params.id
    // newsData.international.find((item,index)=>{
    //   if(item.id == id){
    //     this.detail = item;
    //   }
    // })
    // this.tofindNewsDetail();
  },
  methods:{
     //新闻详情查询
      async tofindNewsDetail () {
          const res = await this.$store.dispatch('news/tofindNewsDetail',this.id)
          if (res.status) {
            this.detail = res.data;
          } 
      },
  }
}
</script>
<style lang="scss">
</style>